﻿<UserControl xmlns:igEditors="http://infragistics.com/Editors"  
             x:Class="BeeCoders.Tools.ControlCanvas.Controls.CheckBoxControl"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:Infrastructure="clr-namespace:BeeCoders.Tools.ControlCanvas.Infrastructure" 
			 xmlns:vm="clr-namespace:BeeCoders.Tools.ControlCanvas"
             xmlns:InputControls="clr-namespace:BeeCoders.Tools.ControlCanvas.Controls" mc:Ignorable="d" 
             d:DataContext="{d:DesignInstance vm:ControlViewModelDemo, IsDesignTimeCreatable=True}"
             d:DesignHeight="28" d:DesignWidth="200"
             KeyboardNavigation.TabNavigation="Local">

    <UserControl.Resources>
        <BooleanToVisibilityConverter x:Key="BoolToVisible"></BooleanToVisibilityConverter>
        <Infrastructure:BooleanToHiddenVisibility x:Key="BoolToHidden"></Infrastructure:BooleanToHiddenVisibility>
        <Infrastructure:TrueToFalse x:Key="TrueToFalse"></Infrastructure:TrueToFalse>

        <!--<Style x:Key="Triggers" TargetType="{x:Type Border}">
            <Style.Triggers>
                <Trigger Property="IsHitTestVisible" Value="True">
                    <Setter Property="BorderThickness" Value="1"></Setter>
                </Trigger>
                <Trigger Property="IsHitTestVisible" Value="False">
                    <Setter Property="BorderThickness" Value="0"></Setter>
                </Trigger>
            </Style.Triggers>
        </Style>-->
    </UserControl.Resources>

    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="16" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*" />
            <ColumnDefinition Width="20" />
        </Grid.ColumnDefinitions>

        <!-- Properties popup and button-->
        <Popup Margin="10,10,0,0" Name="PropPopup" HorizontalAlignment="Left"
               VerticalAlignment="Top" 
               PlacementTarget="{Binding ElementName=PropButton}"
               Width="500" Height="500" 
               IsOpen="{Binding ElementName=PropButton,Path=IsChecked}"
               IsHitTestVisible="{Binding Path=IsInDesign}">

            <InputControls:InputControlPropertyView DataContext="{Binding}"></InputControls:InputControlPropertyView>
        </Popup>

        <InputControls:ControlPropertyHandleView x:Name="PropButton" Grid.Column="1" Grid.RowSpan="2"></InputControls:ControlPropertyHandleView>

        <TextBlock Grid.Column="2"
                   Text="*"
                   Margin="2,2,2,2"
                   Foreground="Red"
                   Visibility="{Binding Path=IsRequired, Converter={StaticResource BoolToVisible}}" 
                   FontWeight="Normal" FontSize="14" 
                   IsHitTestVisible="{Binding IsInDesign, Converter={StaticResource TrueToFalse}}">

        </TextBlock>

        <TextBlock Grid.Column="1" Grid.RowSpan="2" IsHitTestVisible="True" Visibility="{Binding Path=IsInDesign, Converter={StaticResource BoolToHidden}}" ></TextBlock>

        <Border BorderBrush="Gray" 
                BorderThickness="1"
                Grid.RowSpan="2"
                Visibility="{Binding Path=IsInDesign, Converter={StaticResource BoolToVisible}}" 
                IsHitTestVisible="{Binding IsInDesign, Converter={StaticResource TrueToFalse}}">




        </Border>
        <CheckBox Grid.RowSpan="2" Grid.Column="0"
                  Content="{Binding Prompt}"
                  IsChecked="{Binding ParameterValueBool}"
                  IsHitTestVisible="{Binding IsInDesign, Converter={StaticResource TrueToFalse}}">

        </CheckBox>


    </Grid>


</UserControl>
